<template>
  <div>
    <el-form :model="form" label-width="auto" style="max-width: 600px; display: flex; flex-wrap: nowrap;">
      <el-form-item label="服务名称:" style="width: 200px">
        <el-input v-model="form.serveItemName" />
      </el-form-item>
      <el-form-item label="服务等级:" style="width: 200px">
        <el-input v-model="form.score" />
      </el-form-item>
      <el-button @click="findList()" type="primary">查询</el-button>
      <el-button @click="cleanForm()" type="primary">清空</el-button>
    </el-form>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="serveAfterIllustrate" label="评价内容" />
      <el-table-column prop="score" label="评价评分" />
      <el-table-column prop="serveItemName" label="服务名称" />
      <el-table-column prop="contactsName" label="评价人" />
      <el-table-column prop="serveAfterImgs" label="服务后图片" >
        <template v-slot="scope">
          <img :src="scope.row.serveAfterImgs" style="width: 100px;height: 100px" />
        </template>
      </el-table-column>
      <el-table-column prop="realServeEndTime" label="评价时间" />
    </el-table>
    <div class="demo-pagination-block">
      <el-pagination
        v-model:current-page="form.pageNum"
        v-model:page-size="form.pageSize"
        :page-sizes="[10, 20, 30, 40]"
        :size="size"
        :disabled="disabled"
        :background="background"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
const tableData=ref([])
import {findAll} from "@/api/appraise/appraise";
const form=ref({
  pageNum:1,
  pageSize:10
})
const total=ref()
function findList(){
  findAll(form.value).then(arr =>{
    tableData.value=arr.data.data.records
    total.value=arr.data.data.total
  })
}
findList()
const handleSizeChange = (val) => {
  form.value.pageSize=val
  findList()
}
const handleCurrentChange = (val) => {
  form.value.pageNum=val
  findList()
}
function cleanForm(){
  form.value.score=null
  form.value.serveItemName=null
}
</script>
